home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / ADSP.p next >
Encoding:
Text File  |  1997-08-12  |  8.6 KB  |  227 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        ADSP.p
  3.  
  4.      Contains:    AppleTalk Data Stream Protocol (ADSP) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1986-1993, 1995-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT ADSP;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __ADSP__}
  28. {$SETC __ADSP__ := 1}
  29.  
  30. {$I+}
  31. {$SETC ADSPIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __ERRORS__}
  35. {$I Errors.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __APPLETALK__}
  38. {$I AppleTalk.p}
  39. {$ENDC}
  40.  
  41.  
  42. {$PUSH}
  43. {$ALIGN MAC68K}
  44. {$LibExport+}
  45.  
  46. {driver control csCodes}
  47.  
  48. CONST
  49.     dspInit                        = 255;                            {  create a new connection end  }
  50.     dspRemove                    = 254;                            {  remove a connection end  }
  51.     dspOpen                        = 253;                            {  open a connection  }
  52.     dspClose                    = 252;                            {  close a connection  }
  53.     dspCLInit                    = 251;                            {  create a connection listener  }
  54.     dspCLRemove                    = 250;                            {  remove a connection listener  }
  55.     dspCLListen                    = 249;                            {  post a listener request  }
  56.     dspCLDeny                    = 248;                            {  deny an open connection request  }
  57.     dspStatus                    = 247;                            {  get status of connection end  }
  58.     dspRead                        = 246;                            {  read data from the connection  }
  59.     dspWrite                    = 245;                            {  write data on the connection  }
  60.     dspAttention                = 244;                            {  send an attention message  }
  61.     dspOptions                    = 243;                            {  set connection end options  }
  62.     dspReset                    = 242;                            {  forward reset the connection  }
  63.     dspNewCID                    = 241;                            {  generate a cid for a connection end  }
  64.  
  65.                                                                 {  connection opening modes  }
  66.     ocRequest                    = 1;                            {  request a connection with remote  }
  67.     ocPassive                    = 2;                            {  wait for a connection request from remote  }
  68.     ocAccept                    = 3;                            {  accept request as delivered by listener  }
  69.     ocEstablish                    = 4;                            {  consider connection to be open  }
  70.  
  71.                                                                 {  connection end states  }
  72.     sListening                    = 1;                            {  for connection listeners  }
  73.     sPassive                    = 2;                            {  waiting for a connection request from remote  }
  74.     sOpening                    = 3;                            {  requesting a connection with remote  }
  75.     sOpen                        = 4;                            {  connection is open  }
  76.     sClosing                    = 5;                            {  connection is being torn down  }
  77.     sClosed                        = 6;                            {  connection end state is closed  }
  78.  
  79.                                                                 {  client event flags  }
  80.     eClosed                        = $80;                            {  received connection closed advice  }
  81.     eTearDown                    = $40;                            {  connection closed due to broken connection  }
  82.     eAttention                    = $20;                            {  received attention message  }
  83.     eFwdReset                    = $10;                            {  received forward reset advice  }
  84.  
  85.                                                                 {  miscellaneous constants  }
  86.     attnBufSize                    = 570;                            {  size of client attention buffer  }
  87.     minDSPQueueSize                = 100;                            {  Minimum size of receive or send Queue  }
  88.  
  89. { connection control block }
  90.  
  91. TYPE
  92.     TRCCBPtr = ^TRCCB;
  93.     TPCCB                                = ^TRCCB;
  94.     TRCCB = PACKED RECORD
  95.         ccbLink:                TPCCB;                                    {  link to next ccb  }
  96.         refNum:                    UInt16;                                    {  user reference number  }
  97.         state:                    UInt16;                                    {  state of the connection end  }
  98.         userFlags:                UInt8;                                    {  flags for unsolicited connection events  }
  99.         localSocket:            UInt8;                                    {  socket number of this connection end  }
  100.         remoteAddress:            AddrBlock;                                {  internet address of remote end  }
  101.         attnCode:                UInt16;                                    {  attention code received  }
  102.         attnSize:                UInt16;                                    {  size of received attention data  }
  103.         attnPtr:                Ptr;                                    {  ptr to received attention data  }
  104.         reserved:                PACKED ARRAY [0..219] OF UInt8;            {  for adsp internal use  }
  105.     END;
  106.  
  107.     ADSPConnectionEventProcPtr = Register68kProcPtr;  { PROCEDURE ADSPConnectionEvent(sourceCCB: TPCCB); }
  108.  
  109.     ADSPCompletionProcPtr = Register68kProcPtr;  { PROCEDURE ADSPCompletion(thePBPtr: DSPPBPtr); }
  110.  
  111.     ADSPConnectionEventUPP = UniversalProcPtr;
  112.     ADSPCompletionUPP = UniversalProcPtr;
  113.     DSPParamBlockPtr = ^DSPParamBlock;
  114.     DSPParamBlock = PACKED RECORD
  115.         qLink:                    QElemPtr;
  116.         qType:                    INTEGER;
  117.         ioTrap:                    INTEGER;
  118.         ioCmdAddr:                Ptr;
  119.         ioCompletion:            ADSPCompletionUPP;
  120.         ioResult:                OSErr;
  121.         ioNamePtr:                StringPtr;
  122.         ioVRefNum:                INTEGER;
  123.         ioCRefNum:                INTEGER;                                {  adsp driver refNum  }
  124.         csCode:                    INTEGER;                                {  adsp driver control code  }
  125.         qStatus:                LONGINT;                                {  adsp internal use  }
  126.         ccbRefNum:                INTEGER;
  127.         CASE INTEGER OF
  128.         0: (
  129.             ccbPtr:                TPCCB;                                    {  pointer to connection control block  }
  130.             userRoutine:        ADSPConnectionEventUPP;                    {  client routine to call on event  }
  131.             sendQSize:            UInt16;                                    {  size of send queue (0..64K bytes)  }
  132.             sendQueue:            Ptr;                                    {  client passed send queue buffer  }
  133.             recvQSize:            UInt16;                                    {  size of receive queue (0..64K bytes)  }
  134.             recvQueue:            Ptr;                                    {  client passed receive queue buffer  }
  135.             attnPtr:            Ptr;                                    {  client passed receive attention buffer  }
  136.             localSocket:        UInt8;                                    {  local socket number  }
  137.             filler1:            UInt8;                                    {  filler for proper byte alignment  }
  138.            );
  139.         1: (
  140.             localCID:            UInt16;                                    {  local connection id  }
  141.             remoteCID:            UInt16;                                    {  remote connection id  }
  142.             remoteAddress:        AddrBlock;                                {  address of remote end  }
  143.             filterAddress:        AddrBlock;                                {  address filter  }
  144.             sendSeq:            UInt32;                                    {  local send sequence number  }
  145.             sendWindow:            UInt16;                                    {  send window size  }
  146.             recvSeq:            UInt32;                                    {  receive sequence number  }
  147.             attnSendSeq:        UInt32;                                    {  attention send sequence number  }
  148.             attnRecvSeq:        UInt32;                                    {  attention receive sequence number  }
  149.             ocMode:                UInt8;                                    {  open connection mode  }
  150.             ocInterval:            UInt8;                                    {  open connection request retry interval  }
  151.             ocMaximum:            UInt8;                                    {  open connection request retry maximum  }
  152.             filler2:            UInt8;                                    {  filler for proper byte alignment  }
  153.            );
  154.         2: (
  155.             abort:                UInt8;                                    {  abort connection immediately if non-zero  }
  156.             filler3:            UInt8;                                    {  filler for proper byte alignment  }
  157.            );
  158.         3: (
  159.             reqCount:            UInt16;                                    {  requested number of bytes  }
  160.             actCount:            UInt16;                                    {  actual number of bytes  }
  161.             dataPtr:            Ptr;                                    {  pointer to data buffer  }
  162.             eom:                UInt8;                                    {  indicates logical end of message  }
  163.             flush:                UInt8;                                    {  send data now  }
  164.            );
  165.         4: (
  166.             attnCode:            UInt16;                                    {  client attention code  }
  167.             attnSize:            UInt16;                                    {  size of attention data  }
  168.             attnData:            Ptr;                                    {  pointer to attention data  }
  169.             attnInterval:        UInt8;                                    {  retransmit timer in 10-tick intervals  }
  170.             filler4:            UInt8;                                    {  filler for proper byte alignment  }
  171.            );
  172.         5: (
  173.             statusCCB:            TPCCB;                                    {  pointer to ccb  }
  174.             sendQPending:        UInt16;                                    {  pending bytes in send queue  }
  175.             sendQFree:            UInt16;                                    {  available buffer space in send queue  }
  176.             recvQPending:        UInt16;                                    {  pending bytes in receive queue  }
  177.             recvQFree:            UInt16;                                    {  available buffer space in receive queue  }
  178.            );
  179.         6: (
  180.             sendBlocking:        UInt16;                                    {  quantum for data packets  }
  181.             sendTimer:            UInt8;                                    {  send timer in 10-tick intervals  }
  182.             rtmtTimer:            UInt8;                                    {  retransmit timer in 10-tick intervals  }
  183.             badSeqMax:            UInt8;                                    {  threshold for sending retransmit advice  }
  184.             useCheckSum:        UInt8;                                    {  use ddp packet checksum  }
  185.            );
  186.         7: (
  187.             newcid:                UInt16;                                    {  new connection id returned  }
  188.            );
  189.     END;
  190.  
  191.     DSPPBPtr                            = ^DSPParamBlock;
  192.  
  193. CONST
  194.     uppADSPConnectionEventProcInfo = $0000B802;
  195.     uppADSPCompletionProcInfo = $00009802;
  196.  
  197. FUNCTION NewADSPConnectionEventProc(userRoutine: ADSPConnectionEventProcPtr): ADSPConnectionEventUPP;
  198.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  199.     INLINE $2E9F;
  200.     {$ENDC}
  201.  
  202. FUNCTION NewADSPCompletionProc(userRoutine: ADSPCompletionProcPtr): ADSPCompletionUPP;
  203.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  204.     INLINE $2E9F;
  205.     {$ENDC}
  206.  
  207. PROCEDURE CallADSPConnectionEventProc(sourceCCB: TPCCB; userRoutine: ADSPConnectionEventUPP);
  208.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  209.     {To be implemented:  Glue to move parameters into registers.}
  210.     {$ENDC}
  211.  
  212. PROCEDURE CallADSPCompletionProc(thePBPtr: DSPPBPtr; userRoutine: ADSPCompletionUPP);
  213.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  214.     {To be implemented:  Glue to move parameters into registers.}
  215.     {$ENDC}
  216.  
  217. {$ALIGN RESET}
  218. {$POP}
  219.  
  220. {$SETC UsingIncludes := ADSPIncludes}
  221.  
  222. {$ENDC} {__ADSP__}
  223.  
  224. {$IFC NOT UsingIncludes}
  225.  END.
  226. {$ENDC}
  227.